package demo1;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 具体装饰器：将单词转为小写
 */
public class LowerCaseDecorator extends WordReaderDecorator {
    public LowerCaseDecorator(WordReader wordReader) {
        super(wordReader);
    }

    @Override
    protected List<String> decorate(List<String> words) {
        List<String> lowerWords = words.stream()
                .map(String::toLowerCase) // 转小写
                .collect(Collectors.toList());
        System.out.printf("装饰器-转小写：处理完成，列表：%s%n", lowerWords);
        return lowerWords;
    }
}
